import { Component, OnInit } from '@angular/core';
import { Singlepage } from '../../model/singlepage';
import { SinglepageService } from '../../service/singlepage.service';

@Component({
  selector: 'app-singlepagelist',
  templateUrl: './singlepagelist.component.html',
  styleUrls: ['./singlepagelist.component.css']
})
export class SinglepagelistComponent implements OnInit {
  sl:Array<Singlepage>;

  // images:Array<string>;
  constructor(
    private singlepageservice:SinglepageService
  ) {
    this.sl = new Array();
//     this.sl=new Array();
//     for(let i=0;i<3;i++){
//       let s=new Singlepage();
//         s.singlepageid="id"+i;
//         s.img   ="" ;
//         s.summary="摘要"+i;
//         s.title="标题"+i;
//         s.detail="正文内容"+i;

// this.sl.push(s);
//     }


   }

  ngOnInit() {
    this.sl = new Array();
    this.singlepageservice.getSinglepageList()
    .then((data:any)=>{
      this.sl = data;
      console.log(this.sl[0].img);
    })
  }

}
